


function read(){
    UI_ = currentActivity()
    console.log(UI_)

    if (f.ms({"text":"欢迎发表你的观点"})){
        console.log('欢迎发表你的观点', '在文章页')
        if( appinfo.video_state == 'read' ){

            
            var  nowTime = new Date().getTime()

            console.log('视频播放中', 65 * 1000 - (nowTime - appinfo.video_see_time))

            if ( nowTime - appinfo.video_see_time > 65 * 1000 ){
                appinfo.video_state = 'see'
            }else{
                f.moveTo(appinfo.device.width*0.5, appinfo.device.height * 0.8, appinfo.device.width*0.5, appinfo.device.width * 0.3, 2000)
                sleep(f.rd(3000,8000))
            }

        }
        else
        {
            back()
        }
    }else
    if( f.ms({"id":"comm_head_xuexi_score"})  ){
        console.log('comm_head_xuexi_score', '主页面')
        if (appinfo.video_state == 'see'){
            f.ms({"id":"comm_head_xuexi_score"},true, 2)
        }else
        if ( appinfo.video_state == 'read' ){
            var title_id = id('general_card_title_id').find()
            if( title_id ){
                for(var i = 0; i < title_id.length; i++){
                    console.log(i, title_id[i].text())
        
                    if ( !appinfo.video_title_id.includes(title_id[i].text())){
                        appinfo.video_title_id.push(title_id[i].text())
                        f.setLocal('video_title_id', appinfo.video_title_id)
                        console.log('add title_id')
                        f.clickObj(title_id[i], 3, title_id[i].text())
                        appinfo.video_see_time = new Date().getTime()
                        break
                    }
                }
                appinfo.video_see_up = appinfo.video_see_up?appinfo.video_see_up:0
                appinfo.video_see_up++
                if( appinfo.video_see_up > 20 ){
                    appinfo.video_see_up = 0
                    back()
                    f.ms({"text":"电视台"},true,2)
                    f.ms({"text":"第一频道"},true,2)
                }
                f.moveTo(appinfo.device.width*0.5, appinfo.device.height * 0.8, appinfo.device.width*0.5, appinfo.device.width * 0.3, 2000)
            }else{
                f.ms({"text":"电视台"},true,2)
                f.ms({"text":"第一频道"},true,2)
            }

            // if( !f.ms({"text":"第一频道"})){ f.ms({"text":"电视台"},true,2) }

        }
    }else

    if ( f.ms({"text":"学习积分"})  ){
        console.log('comm_head_xuexi_score', '任务页面')
        if( appinfo.video_state == 'see' ){
            // console.log('点开查看分数')
            var res = text('我要视听学习').findOne(200)
            if ( res ){
                res = res.parent()
                var readinfo = son(res, false)
                if ( readinfo.length > 0 ){
                    console.log('任务进度', readinfo)
                    appinfo.video_times = readinfo[3][0]
                    console.log(`任务进度${appinfo.video_times}/${readinfo[4]}`)
                }
                if ( appinfo.video_times == '12' ){
                    appinfo.video_state = false
                }else{
                    appinfo.video_state = 'read'
                    son(res, true)
                }
            }else{
                console.log('错误, 没有找到视听')
            }

        }
        else if( appinfo.video_state == 'read')
        {
            back()
        }

    }else{
        back()
    }


}







module.exports = {
    read
};